import Vue from "vue"
import  Router from "vue-router"

Vue.use(Router)

export default () => {
    return new Router({
        mode: 'history',  // 兼容前后端，不支持hash
        routes: [{
            path: '/',
            name: 'home',
            component: () => import(/* webpackChunkName: "home" */ '@/pages/home')
        }, {
            path: '/about',
            name: 'about',
            component: () => import(/* webpackChunkName: "about" */ '@/pages/about')
        }, {
            path: '*',
            name: 'error404',
            component: () => import(/* webpackChunkName: "404" */ '@/pages/404')
        }, {
            path: '/posts',
            name: 'posts',
            component: () => import(/* webpackChunkName: "404" */ '@/pages/posts')
        }]
    })
} 